import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const Recommend = (resolve) => {
  import('@comp/recommend/recommend').then((module) => {
    console.log('load recommend')
    resolve(module)
  })
}

const Singer = (resolve) => {
  import('@comp/singer/singer').then((module) => {
    console.log('load singer')
    resolve(module)
  })
}

const Rank = (resolve) => {
  import('@comp/rank/rank').then((module) => {
    console.log('load rank')
    resolve(module)
  })
}

const Search = (resolve) => {
  import('@comp/search/search').then((module) => {
    console.log('load search')
    resolve(module)
  })
}

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/recommend'
    },
    {
      path: '/recommend',
      component: Recommend
      // children: [
      //   {
      //     path: ':id',
      //     component: Disc
      //   }
      // ]
    },
    {
      path: '/singer',
      component: Singer
      // children: [
      //   {
      //     path: ':id',
      //     component: SingerDetail
      //   }
      // ]
    },
    {
      path: '/rank',
      component: Rank
      // children: [
      //   {
      //     path: ':id',
      //     component: TopList
      //   }
      // ]
    },
    {
      path: '/search',
      component: Search
      // children: [
      //   {
      //     path: ':id',
      //     component: SingerDetail
      //   }
      // ]
    }
  ]
})
